#include "av.h"

DEFINE_TYPE_STRUCT(stream, AVStream,
	LUA_OBJECT_STREAM_ID, av_free, 0)

static
void lua_av_stream_push_codec(lua_State * L, AVCodecContext * ctx) {
	lua_av_object * o = lua_push_codec_context(L, ctx);
	o->destroy = 0;
}

DEFINE_INDEX_HEADER(stream, AVStream)
	HANDLE_INDEX_ENTRY(index, lua_pushinteger);
	HANDLE_INDEX_ENTRY(codec, lua_av_stream_push_codec);
DEFINE_INDEX_TRAILER()

DEFINE_NEWINDEX_HEADER(stream, AVStream)
DEFINE_NEWINDEX_TRAILER()

DEFINE_OBJECT_FUNCTIONS(stream, AVStream)
